<?php
/**
 * Created by PhpStorm.
 * User: white
 * Date: 2020/4/29
 * Time: 14:11
 */
namespace app\common\validate;

use think\Validate;

class Admin extends Validate
{
    protected $rule = [
        'account|账号' => 'require',
        'password|密码' => 'require|min:6',
        'nickname|昵称' => 'require',
        'email|联系邮箱' => 'require|email',
        'code|验证码' => 'require',
        'oldpassword|原密码' => 'require|min:6',
        'npassword|新密码' => 'require|min:6',
        'qpassword|确认密码' => 'require|min:6|confirm:npassword'
    ];

    //添加管理员验证场景
    protected $scene = [
        'edit' => [
            'account'=>'require|unique:admin',
            'password',
            'email'=>'require|email|unique:admin'
        ],
        'login' => [
            'account','password'
        ],
        'forget' => [
            'account'
        ],
        'setpass' => [
            'code','npassword','qpassword'
        ],
        'adminedit' => [
            'nickname','email'
        ],
        'adminpass' => [
            'oldpassword','npassword','qpassword'
        ]
    ];



}